package com.demo.reduction;

import com.demo.common.Dish;
import com.demo.common.DishUtil;

import java.util.List;

import static java.util.stream.Collectors.summingInt;

public class TestSummingInt {
    public static void main(String[] args) {
        List<Dish> menu = DishUtil.getDishes();
        int totalCalories = menu.stream().collect(summingInt(Dish::getCalories));
        System.out.println(totalCalories);
    }
}
